﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Ovvio.Data;
using Ovvio.Web.Areas.Member.Models;
using Ovvio.Web.Core;
using Ovvio.Business;

namespace Ovvio.Web.Areas.Member.Controllers
{
    public class IndexController : BaseController<int, MemberModel, User, OvvioDataContext>
    {
        public IndexController() : base(p => p.Id, new UserService()) { }
        
        public override ActionResult Index()
        {
            var service = (UserService)_modelProvider.Service;
            var entity = service.GetUserWithDownline(((UserIdentity)HttpContext.User.Identity).Id);
            var model = new MemberModel() { Entity = entity };
            return View(model);
        }

        public override ActionResult Details(int id)
        {
            var service = (UserService)_modelProvider.Service;
            var entity = service.GetUserWithUpline(id);
            var model = new MemberModel() { Entity = entity };
            return View(model);
        }
    }
}
